package main

import (
	"fmt"
)

type Book struct {
	bookName, authorName string
}

// 书的名称 和 作者
func (b Book) printName() {
	fmt.Printf(" %s ---- %s \n", b.bookName, b.authorName)
}

var s string = "Go语言微服务架构核心22讲"

func main() {
	fmt.Println("无表达式的是 switch")

	//for num := 1; num <= 10; num++ {
	//	if num%2 == 0 {
	//		continue
	//	}
	//	fmt.Println(num)
	//}

	//fmt.Println("defer 延迟调用")
	//defer bookPrint()
	//fmt.Println("main函数。。。")
	//
	//str := "Go语言极简一本通"
	//defer fmt.Println(str)
	//str = "欢喜"
	//fmt.Println(str)

	//fmt.Println()
	//fmt.Println("延迟方法的案例")
	//book := Book{"《Go语言极简一本通》", "欢喜"}
	//defer book.printName()
	//fmt.Printf("main... \n")

	//fmt.Println("defer栈")
	//defer fmt.Printf("从0到Go语言微服务架构师")
	//defer fmt.Printf("Go语言微服务架构核心22讲")
	//defer fmt.Printf("Go语言极简一本通")
	//fmt.Printf("main...")

	lesson := showLesson()
	fmt.Println("main: s = ", s)
	fmt.Println("main lesson = ", lesson)

}

func showLesson() string {
	defer func() {
		s = "从0到Go语言微服务架构师"
	}()
	fmt.Println("showLesson: s = ", s)
	return s
}

func bookPrint() {
	fmt.Println("bookPrint函数， Go语言极简一本通")
}
